package com.fieldIndustry.service.impl;

import com.base.service.impl.ServiceImpl;
import com.fieldIndustry.pojo.Authorcode;
import com.fieldIndustry.service.IAuthorcodeService;

public class AuthorcodeServiceImpl<T extends Authorcode> extends ServiceImpl<T>
		implements IAuthorcodeService<T> {

	@Override
	public boolean create(T Authorcode) {
		if (dao.createQuery(" from Authorcode d where d.authorcode = :name ")
				.setParameter("name", Authorcode.getAuthorCode()).list().size() > 0) {
			return false;

		} else {

			dao.create(Authorcode);
			return true;
		}

	}

	public Boolean createAuthor(T Authorcode) {
		if (dao.createQuery(" from Authorcode d where d.authorCode = :name ")
				.setParameter("name", Authorcode.getAuthorCode()).list().size() > 0) {
			return false;
		} else {

			dao.create(Authorcode);
			return true;
		}

	}

}
